﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<title>LocMsg</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../styles/styles.css">
<script language="javascript" src='../links.js' type="text/javascript"></script>
<meta NAME="Author" content="Ivan Sintyurin">
<meta NAME="Lang" content="C/C++">
<meta NAME="Func" content="LocMsg">
</head>
<body>

<h1>LocMsg</h1>
<div class=navbar>
<a href="../index.html">main</a> |
<a href="index.html">Addons</a><br>
</div>


<div class=shortdescr>
The <dfn>LocMsg</dfn> function returns a pointer to a string according to the language
settings of FAR Manager. It is an analogue of the standard
<a href="../service_functions/getmsg.html">GetMsg</a> function.

<p class=note><img src="../../images/caution.gif" alt="Attention!" width="10" height="10"> Attention!</p>
<UL class=note><LI>The <dfn>LocMsg</dfn> function function is not part of the standard API. The
source code is available <a href="LocMsg.cpp.txt">here</a>.</LI></UL>
</div>

<pre class=syntax>
char *LocMsg(
  struct PluginStartupInfo *psi,
  char *MsgName,
  char *Var,
  int Len
);
</pre>

<h3>Parameters</h3>
<div class=descr>
    <div class=dfn>psi</div>
    <div class=dfndescr>Pointer to a <a href="../structures/pluginstartupinfo.html">PluginStartupInfo</a>
      structure; it is used to get RootKey and ModuleNumber variables.</div>
    <div class=dfn>MsgName</div>
    <div class=dfndescr>Name of the requested message.</div>
    <div class=dfn>Var</div>
    <div class=dfndescr>If not NULL, points to a buffer that receives the requested string.</div>
    <div class=dfn>Len</div>
    <div class=dfndescr>If zero, all the data is copied.</div>
</div>

<h3>Return value</h3>
<div class=descr>
  Pointer to the requested string.
</div>

<h3>Remarks</h3>
<div class=descr>
<ol>
  <li>In contrast to the <a href="../service_functions/getmsg.html">GetMsg</a>,
  this function does not cache data. This allows to change data dynamically
  (without restarting FAR Manager, etc.).
  <li>The LocMsg function may be used to
  "localize" <!--"<a href="../articles/localization.html">localize</a>"--> "second level"
  plugins.
  <li>It considers the language setting of the current user.
  <li>A file containing the messages should be located in the same folder, as the plugin,
  and should be named as following: <b>PluginName.msg</b>.
  It is a standard ini-file with the following structure:
<pre class=code>[Default]
//This section defines the default language section, which will be used,
//if the requested section is not found.
//It is an optional section, if it is absent, first section will be the
//default.
Language=Russian

//Section names SHOULD be taken from the first line of
//the corresponding .lng file:
//.Language=Russian,Russian (Русский)
//          ^^^^^^^
//          This should be the the name of the section

[Russian]
String1=Текст первого сообщения
String2=Текст второго сообщения
IsSkipNoWord=1

[English]
String1=Text of the first message
String2=Text of the second message
IsSkipNoWord=1
//etc.
</pre>
</ol>
</div>

<h3>Example</h3>
<div class=descr>
<pre class=code>  BOOL IsSkipNoWord;
  p=LocMsg("IsSkipNoWord",NULL,1);
  IsSkipNoWord=(*p != '0')?TRUE:FALSE;

  phf=strrchr(LocMsg(temp,"String1",956),".");
</pre>

</div>

<div class=see>See also:</div><div class=seecont>
<a href="../service_functions/getmsg.html">GetMsg</a> |
<a href="../language/language_files.html">Language files</a> <!-- |
<a href="../articles/localization.html">"Localization of second level plugins"</a> -->
</div>
</body>
</html>